const KEY = 'my-token-vant-mobile'
const NAME = 'my-username'
const CITYNAME = 'city-name'

// 直接用按需导出，可以导出多个
// 但是按需导出，导入时必须 import { getToken } from '模块名导入'
//取名字
export const getName = () => {
  return localStorage.getItem(NAME)
}
//存名字
export const setName = (newToken) => {
  localStorage.setItem(NAME, newToken)
}

// 设置
export const setToken = (newToken) => {
  localStorage.setItem(KEY, newToken)
}

// 获取
export const getToken = () => {
  return localStorage.getItem(KEY)
}

// 删除
export const delToken = () => {
  localStorage.removeItem(KEY)
}



//存城市的值
export const setCity = (newToken) => {
  // localStorage.setItem(CITYNAME, newToken)
  localStorage.setItem('CITYNAME', JSON.stringify(newToken))
}
//取城市的值
export const getCity = () => {
  // return localStorage.setItem(CITYNAME)
  return JSON.parse(localStorage.getItem('CITYNAME'))
}